<?php
// +----------------------------------------------------------------------
// | SwiftPHP [ JUST DO ONE THING WELL ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015-2017  http://swiftphp.zhongwenyu.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: zhongwenyu <zhongwenyu1987@163.com> <http://www.zhongwenyu.com>
// +----------------------------------------------------------------------
// | Times: 2017/2/16 14:32
// +----------------------------------------------------------------------

// 定义系统常量
define('SWIFT_VERSION', '1.0.0');
define('START_TIME', microtime(true));  //返回当前时间搓和微秒数
define('START_MEM', memory_get_usage());   //返回当前内存占用
define('EXT', '.php');   //默认php后缀
define('DS', DIRECTORY_SEPARATOR);   //当前环境下的目录分隔符
defined('SWIFT_PATH') or define('SWIFT_PATH', __DIR__ . DS);    //框架目录
define('LIB_PATH', SWIFT_PATH . 'library' . DS);   //框架系统目录
define('CORE_PATH', LIB_PATH . 'swift' . DS);   //框架核心目录
//define('TRAIT_PATH', LIB_PATH . 'traits' . DS);
defined('APP_PATH') or define('APP_PATH', dirname($_SERVER['SCRIPT_FILENAME']) . DS);    //应用目录
defined('ROOT_PATH') or define('ROOT_PATH', dirname(realpath(APP_PATH)) . DS);    //根目录
defined('PUBLIC_PATH') or define('PUBLIC_PATH', ROOT_PATH . 'public' . DS);    //对外静态目录
defined('EXTEND_PATH') or define('EXTEND_PATH', ROOT_PATH . 'extend' . DS);    //扩展类库目录
defined('VENDOR_PATH') or define('VENDOR_PATH', ROOT_PATH . 'vendor' . DS);    //第三方类库目录
defined('RUNTIME_PATH') or define('RUNTIME_PATH', ROOT_PATH . 'runtime' . DS);    //应用运行时的目录
defined('LOG_PATH') or define('LOG_PATH', RUNTIME_PATH . 'log' . DS);    //日记目录
defined('CACHE_PATH') or define('CACHE_PATH', RUNTIME_PATH . 'cache' . DS);    //缓存目录
defined('TEMP_PATH') or define('TEMP_PATH', RUNTIME_PATH . 'temp' . DS);    //模板编译目录
defined('HTML_PATH') or define('HTML_PATH', RUNTIME_PATH . 'html' . DS);    //静态html缓存目录
defined('CONF_PATH') or define('CONF_PATH', APP_PATH); // 配置文件目录
defined('CONF_EXT') or define('CONF_EXT', EXT); // 配置文件后缀
//defined('ENV_PREFIX') or define('ENV_PREFIX', 'PHP_'); // 环境变量的配置前缀

// 定义常用常量
define('TIME' , time() - date('z'));

// 载入Loader类
require CORE_PATH . 'Loader.php';

// 注册自动加载
\swift\Loader::register();

// 加载惯例配置文件
\swift\Config::set(include SWIFT_PATH . 'convention' . EXT);

// 注册错误和异常处理机制
\swift\Error::register();
